package com.serverdemo.core.processor;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 简易线程池
 * Created by wangqiang on 2020/4/10.
 */
public class ProcessorPool
{
    private ScheduledExecutorService executorService;

    public void init()
    {
        executorService = Executors.newScheduledThreadPool(4);
    }

    public void addProcessor(AbstractProcessor processor)
    {
        executorService.scheduleAtFixedRate(processor, 50, 50, TimeUnit.MILLISECONDS);
    }

}
